<!-- 企业详情 -->
<template>
	<view style="padding: 30rpx;">
		<view class="" style="display: flex;flex-direction: row;justify-content: space-between;align-items: center;">
			<view style="font-size: 40rpx;color: #fff;">
				<view>{{ enterpriseInfo.CompanyName }}</view>
			</view>
			<view class="" @click="onPreview(enterpriseInfo.CompanyLogo, 0, 0)">
				<image :src="enterpriseInfo.CompanyLogo" style="width: 120rpx;height: 120rpx;border-radius: 10rpx;">
				</image>
			</view>
		</view>

		<view class="" style="color: #fff;margin-top: 30rpx;" v-if="enterpriseInfo.CompanyMemo">
			<view style="font-size: 28rpx;">
				公司介绍
			</view>
			<view class="content">
				<text :class="!isShowAllText? 'hidden-text' :''">
					{{enterpriseInfo.CompanyMemo}}
				</text>
				<text class="all-text" style="color: #d6d6d6;" v-if="!isShowAllText && isExceedText"
					@click="onShowAllText">...查看更多</text>
			</view>
		</view>

		<view class="" style="color: #fff;margin-top: 40rpx;"
			v-if="enterpriseInfo.CompanyPics && JSON.parse(enterpriseInfo.CompanyPics).length != 0">
			<view style="font-size: 28rpx;">
				公司照片
			</view>
			<view style="white-space: nowrap;overflow-x: auto;margin-top: 20rpx;">
				<view v-for="(item, index) in JSON.parse(enterpriseInfo.CompanyPics)" :key="index"
					style="display: inline-block;margin-right: 15rpx;">
					<image :src="item" style="height: 200rpx;width: 300rpx;border-radius: 10rpx;" mode="aspectFill"
						@click="onPreview(enterpriseInfo.CompanyPics, index, 1)"></image>
				</view>
			</view>
		</view>

		<view class="" style="color: #fff;margin-top: 40rpx;">
			<view style="font-size: 28rpx;">
				工商信息
			</view>
			<view style="font-size: 24rpx;margin-top: 30rpx;">
				<text>公司全称：</text> <text>{{ enterpriseInfo.CompanyName }}</text>
			</view>

			<view style="font-size: 24rpx;margin-top: 30rpx;">
				<text>企业法人：</text> <text>{{ enterpriseInfo.LegalPerson }}</text>
			</view>

			<view style="font-size: 24rpx;margin-top: 30rpx;">
				<text>成立时间：</text> <text>{{ enterpriseInfo.ComRegdate }}</text>
			</view>

			<view style="font-size: 24rpx;margin-top: 30rpx;">
				<text>注册地址：</text> <text>{{ enterpriseInfo.CompanyAddress }}</text>
			</view>

		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				isShowAllText: false,
				enterpriseInfo: {
					info: ''
				},
				isExceedText: false
			}
		},
		onLoad(params) {

			this.getEnterpriseDetail(params.ArtisterID)
		},
		methods: {
			getEnterpriseDetail(ArtisterID) {
				this.$httpost('/Artister/CompanyInfo', {
					ArtisterID
				}).then(res => {

					this.enterpriseInfo = res.data;

					let info = '';
					info = res.data.CompanyMemo;

					if (info.length > 400) {
						this.enterpriseInfo.CompanyMemo = info.split('').slice(0, 400).join('');
						this.enterpriseInfo.info = info.split('').slice(400).join('');
					} else {
						this.enterpriseInfo.CompanyMemo = info;
					}

					if (this.enterpriseInfo.CompanyMemo && this.enterpriseInfo.CompanyMemo.split('').length >=
						400) {
						this.isExceedText = true;
					} else {
						this.isExceedText = false;
					}
				})
			},
			// 查看全部公司信息
			onShowAllText() {
				this.isShowAllText = true;
				this.enterpriseInfo.CompanyMemo = this.enterpriseInfo.CompanyMemo + this.enterpriseInfo.info
			},
			onPreview(image, index, PreviewType) {
				let previewImage = [];

				if (PreviewType == 0) previewImage.push(image);
				else previewImage = JSON.parse(image);

				uni.previewImage({
					current: index,
					urls: previewImage,
				})
			},
		}
	}
</script>

<style>
	page {
		/* background-image: radial-gradient(circle, #5e5e5e, #555555, #4c4c4c); */
		background-color: #4c4c4c;
	}

	.content {
		font-size: 24rpx;
		margin-top: 20rpx;
		line-height: 44rpx;
		letter-spacing: 1rpx;
		position: relative;
		display: initial;

	}

	.hidden-text {
		/* overflow: hidden;
		display: -webkit-box;
		-webkit-line-clamp: 10;
		-webkit-box-orient: vertical; */
	}

	.all-text {
		/* width: 204rpx; */
		/* position: absolute;
		right: 0;
		bottom: 0; */
		/* background-color: #4c4c4c; */
	}
</style>